export const useStateStore = defineStore('nuxtStore', () => {
  const locale = ref('')
  let localeName = ref('')

  const localeArr = ref([
    {id:'cn',name:'中文'},
    {id:'en',name:'English'}
  ])
 
  const setState = (name: any) => {

    let arr = localeArr.value.filter(m=>m.id ==name)
    let obj = localeArr.value[0]

    if(arr.length>0){
      obj = arr[0]
    }

    locale.value = obj.id
    localeName.value = obj.name
    
  }
 

 
 
  return {
    locale,
    localeArr,
    localeName,
    setState
  }
})
